
using TEngine;
using UnityEngine;
using UnityEngine.UI;

namespace GameLogic
{
    public class TargetCell_Math : MonoBehaviour
    {
        public enum CellState
        {
            Normal,    // 正常状态
            Complete,  // 完成状态
        }
        [SerializeField]
        private int value;

        private CellState cellState;     // 单元格状态
        
        public void SetCellState(CellState state)
        {
            cellState = state;
            if (m_imgBg == null)
            {
                m_imgBg = transform.FindChildComponent<Image>("m_imgBg");
            }
            switch (cellState)
            {
                case CellState.Normal:
                    m_imgBg.color = Color.white;
                    break;
                case CellState.Complete:
                    m_imgBg.color = Color.green;
                    break;
            }
        }
        [SerializeField]
        private Text m_txtValue;
        [SerializeField]
        private Image m_imgBg;

        public void SetValue(int value)
        {
            this.value = value;
            if (m_txtValue == null)
            {
                m_txtValue = transform.FindChildComponent<Text>("m_txtValue");
            }
            m_txtValue.text = value.ToString();
        }
        public int GetValue()
        {
            return value;
        }
    }
}
